#include "StdAfx.h"
#include "Patch.h"
#include "Kernel32Hook.h"
#include "WMPHook.h"

#pragma unmanaged

void* SelectKernel32Method(int num) {
	void* proc = Kernel32Hook[num];
	if (!proc) {
		proc = Kernel32Save[num];
	}
	return proc;
}

PTP_TIMER WINAPI CreateThreadpoolTimerHook(PTP_TIMER_CALLBACK pfnti, PVOID pv, PTP_CALLBACK_ENVIRON pcbe) {
	SyncFuncHook(PTP_TIMER, PCreateThreadpoolTimer, SelectKernel32Method(0), (pfnti, pv, pcbe));
}

void WINAPI CloseThreadpoolTimerHook(PTP_TIMER pti) {
	SyncProcHook(PCloseThreadpoolTimer, SelectKernel32Method(1), (pti));
}

DWORD WINAPI GetTickCountHook() {
	return (*(PGetTickCount)SelectKernel32Method(2))();
}
